auto();



if(!requestScreenCapture(false)){
    log("sdafsdafsdfsfsdfsafsafsdf")
    toast("error")
    exit()
}
sleep(1000)

// var imgPath = "/sdcard/_autoxjs/worker2.png"


//获取图片
/*
log("by:"+1)
var img = captureScreen()
log("by:"+2)
sleep(200)
let x1 = 669
let y1 = 132
let x2 = 696
let y2 = 160
var imgClip = images.clip(img,x1,y1,x2-x1,y2-y1)//291,801
images.save(imgClip,"/sdcard/Pictures/jiaobiao.png")
img.recycle()
//2076 55
*/



/*
//获取颜色
var img = captureScreen()
//
var dot = img.pixel(1526,150)
log("dot:"+dot)
var color = colors.toString(dot)
log("color:"+color)
// click(435,940)

img.recycle()
*/


sleep(1000)
// 查找图片 捐兵 1
/*
let armMe = images.read("/sdcard/Pictures/jiaobiao.png")
let armMeAll = captureScreen()
let result = findImage(armMeAll,armMe,{
    region:[783,20,1660-783,868-20],
    threshold:0.98
});
 
if(result){
    log("has")
    log(result.x)
    log(result.y)
}else{
    log("wu")
};
*/

sleep(1000)
// 查找图片 造兵 2
/*
let armMe = images.read("/sdcard/Pictures/yezhu2.png")
let armMeAll = captureScreen()
let result = findImage(armMeAll,armMe,{
    region:[82,549,1756,420],
    threshold:0.98
});
 
if(result){
    log("has")
    log(result.x)
    log(result.y)
}else{
    log("wu")
};
*/

/*
    let zimg= images.read("/sdcard/Pictures/zengyuan.png");//增援 按钮
    //首页捐兵
     //log("首页捐兵")
     let x1 = 478
     let y1 = 715
     let x2 = 686
     let y2 = 971
  
    let x0 = x1
    let y0 = y1
    let w = x2-x0
    let h = y2-y0
        //log("la=="+la)
        //log(x0,y0,w,h)
    let zimga = captureScreen();
    let zres = findImage(zimga,zimg,{
        region:[x0,y0,w,h],
        threshold:0.8
    });
    zimga.recycle()
    if(zres){
            log("增援按钮 找到了==")
            log(zres.x)
            log(zres.y)
    }else{
            log("增援按钮 没找到")
        
    }
 */   

//查找角标
// let x1 = 669
// let y1 = 100
// let x2 = 719
// let y2 = 191
// /*
let jimg= images.read("/sdcard/Pictures/jiaobiao.png");//角标
sleep(2000)

let jimga = captureScreen();
let jiao = findImage(jimga,jimg,{
    region:[669,100,50,70],//719 135
    threshold:0.8
});
jimga.recycle()
if(jiao){
    log("角标找到了==")
    log(jiao.x)
    log(jiao.y)
}else{
    log("角标没找到")
}
// */
